<template>
    <div>
     
        <div id="city">
            
        </div>
    </div>
</template>

<script>
import api from '../api'

export default {
    name:"City",
    props: {
        city: {
            type:String,
            default:""
        }
    },
    mounted() {
        var cities = [];
        api.getNcovCity().then((res)=>{
            if (res.status === 200) {
                for (let i = 0; i < res.data.retdata.length; i++) {
                    if (res.data.retdata[i].xArea === this.city) {
                        for (let j = 0; j < res.data.retdata[i].subList.length; j++) {
                            var temp = {
                                name:  res.data.retdata[i].subList[j].city+"市",
                                value: res.data.retdata[i].subList[j].confirm,
                            }
                            cities.push(temp)
                        }
                    }
                    
                }
                console.log(cities);
            }
        }).catch((err)=>{
            console.log(err);
        })
        // console.log(this.city);
        this.$charts.provinceMap("city",this.city,cities);
    }
}
</script>

<style scoped>
#city {
    width: 375px;
    height: 500px;
}
</style>